package com.example.dell.fastshopping.mall.entity;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by ${YSH} on 2019/5/7.
 * 描述        ${TODO}
 * <p>
 * 更新者       $author$
 * 更新时间     $Data$
 * 描述         ${TODO}
 */
public class ServerTime {
    private int currentRoundId;// null,
    private long computeTime;// null,
    private int status;// 3,
    private long startRoundTime;// null,
    private long endRoundTime;// null,
    private BigDecimal incrementValue;// 0.2,
    private BigDecimal startPrice;// null,
    private BigDecimal finalPrice;// 720,
    private BigDecimal amount;// null,
    private int userAuctionRound;// 0,
    private BigDecimal integralPrice;// 10,
    private long wiatTime;// null,
    private int currentRound;// 1,
    private long times;// null,
    private long serverTime;// 1557563722449,
    private String userName;// 8BR2j8"
    private List<DuobaoHistory> list;

    public String getStatusString() {
        switch (status) {
            case 1:
                return "进行中";

            case 2:
                return "即将开始";

            case 3:
                return "已结束";

            default:
                return "即将开始";

        }
    }

    public int getCurrentRoundId() {
        return currentRoundId;
    }

    public long getComputeTime() {
        return computeTime;
    }

    public int getStatus() {
        return status;
    }

    public long getStartRoundTime() {
        return startRoundTime;
    }

    public long getEndRoundTime() {
        return endRoundTime;
    }

    public BigDecimal getIncrementValue() {
        if (incrementValue == null) {
            return new BigDecimal(0);
        }
        return incrementValue;
    }

    public BigDecimal getStartPrice() {
        return startPrice;
    }

    public BigDecimal getFinalPrice() {
        return finalPrice;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public int getUserAuctionRound() {
        return userAuctionRound;
    }

    public int getIntegralPrice() {
        if (integralPrice == null) {
            return 0;
        } else {
            return integralPrice.intValue();
        }
    }

    public long getWiatTime() {
        return wiatTime;
    }

    public int getCurrentRound() {
        return currentRound;
    }

    public long getTimes() {
        return times;
    }

    public long getServerTime() {
        return serverTime;
    }

    public String getUserName() {
        return userName;
    }

    public void setCurrentRoundId(int currentRoundId) {
        this.currentRoundId = currentRoundId;
    }

    public void setComputeTime(long computeTime) {
        this.computeTime = computeTime;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public void setStartRoundTime(long startRoundTime) {
        this.startRoundTime = startRoundTime;
    }

    public void setEndRoundTime(long endRoundTime) {
        this.endRoundTime = endRoundTime;
    }

    public void setIncrementValue(BigDecimal incrementValue) {
        this.incrementValue = incrementValue;
    }

    public void setStartPrice(BigDecimal startPrice) {
        this.startPrice = startPrice;
    }

    public void setFinalPrice(BigDecimal finalPrice) {
        this.finalPrice = finalPrice;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public void setUserAuctionRound(int userAuctionRound) {
        this.userAuctionRound = userAuctionRound;
    }

    public void setIntegralPrice(BigDecimal integralPrice) {
        this.integralPrice = integralPrice;
    }

    public void setWiatTime(long wiatTime) {
        this.wiatTime = wiatTime;
    }

    public void setCurrentRound(int currentRound) {
        this.currentRound = currentRound;
    }

    public void setTimes(long times) {
        this.times = times;
    }

    public void setServerTime(long serverTime) {
        this.serverTime = serverTime;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getFinalPriceString() {
        if (finalPrice == null) {
            return "0.00";
        }
        String s = finalPrice.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
        return s;
    }

    public String getStartPriceString() {

        if (startPrice == null) {
            return "0.00";
        }
        String s = startPrice.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
        return s;
    }

    public int getInputNumber() {

        if (startPrice == null && finalPrice == null) {
            return 0;
        }
        int price;
        if (finalPrice != null) {
            price = finalPrice.setScale(0, BigDecimal.ROUND_UP).intValue(); // 向上取整
        } else if (startPrice != null) {
            price = startPrice.setScale(0, BigDecimal.ROUND_UP).intValue(); // 向上取整
        } else {
            price = 0;
        }
        return price;
    }

    public String getIncrementValueIntString() {
        if (incrementValue == null) {
            return "0";
        } else {
            return incrementValue.setScale(0, BigDecimal.ROUND_UP).toString();
        }

    }

    public class DuobaoHistory {
        private int id; // 385,
        private long createTime; // 15574716428
        private BigDecimal balance; // 6,
        private long auctionTime; // 1557471612
        private BigDecimal price; // 720,
        private int auctionRoundsId; // 766,
        private int status; // 1,
        private int userId; // 1052,
        private String userName; // 8BR2j8,
        private int round; // 1


        public void setId(int id) {
            this.id = id;
        }

        public void setCreateTime(long createTime) {
            this.createTime = createTime;
        }

        public void setBalance(BigDecimal balance) {
            this.balance = balance;
        }

        public void setAuctionTime(long auctionTime) {
            this.auctionTime = auctionTime;
        }

        public void setPrice(BigDecimal price) {
            this.price = price;
        }

        public void setAuctionRoundsId(int auctionRoundsId) {
            this.auctionRoundsId = auctionRoundsId;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public void setUserId(int userId) {
            this.userId = userId;
        }

        public void setUserName(String userName) {
            this.userName = userName;
        }

        public void setRound(int round) {
            this.round = round;
        }

        public int getId() {
            return id;
        }

        public long getCreateTime() {
            return createTime;
        }

        public String getBalanceString() {
            if (balance == null) {
                return "返利￥0.00";
            } else {
                return "返利￥" + balance.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
            }
        }

        public long getAuctionTime() {
            return auctionTime;
        }

        public BigDecimal getPrice() {
            return price;
        }

        public int getAuctionRoundsId() {
            return auctionRoundsId;
        }

        public int getStatus() {
            return status;
        }

        public int getUserId() {
            return userId;
        }

        public String getUserName() {
            return userName;
        }

        public int getRound() {
            return round;
        }
    }

    public List<DuobaoHistory> getList() {
        return list;
    }

    public void setList(List<DuobaoHistory> list) {
        this.list = list;
    }
}
